﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace GuidGeneratorWPF
{
	/// <summary>
	/// Interaction logic for GuidCountWindow.xaml
	/// </summary>
	public partial class GuidCountWindow : Window
	{
		public string GuidCountText
		{
			get { return (string)GetValue(GuidCountTextProperty); }
			set
			{
				SetValue(GuidCountProperty, int.Parse(value));
				SetValue(GuidCountTextProperty, value);
			}
		}

		// Using a DependencyProperty as the backing store for GuidCountText.  This enables animation, styling, binding, etc...
		public static readonly DependencyProperty GuidCountTextProperty =
			 DependencyProperty.Register("GuidCountText", typeof(string), typeof(GuidCountWindow), new UIPropertyMetadata("2"));


		public int GuidCount
		{
			get { return (int)GetValue(GuidCountProperty); }
			set { SetValue(GuidCountProperty, value); }
		}

		// Using a DependencyProperty as the backing store for GuidCount.  This enables animation, styling, binding, etc...
		public static readonly DependencyProperty GuidCountProperty =
			 DependencyProperty.Register("GuidCount", typeof(int), typeof(GuidCountWindow), new UIPropertyMetadata(0));

		public GuidCountWindow()
		{
			InitializeComponent();

			this.textBoxCount.Focus();
			this.textBoxCount.SelectAll();
		}

		private void ButtonOK_Click(object sender, RoutedEventArgs e)
		{
			this.DialogResult = true;
			this.Close();
		}

		private void ButtonCancel_Click(object sender, RoutedEventArgs e)
		{
			this.DialogResult = false;
			this.Close();
			e.Handled = true;
		}
	}
}
